{% assign items_max = 0 %}
{% for item in include.taxonomies %}
  {% if item[1].size > items_max %}
    {% assign items_max = item[1].size %}
  {% endif %}
{% endfor %}

<ul class="taxonomy__index">
  {% for i in (1..items_max) reversed %}
    {% for item in include.taxonomies %}
      {% if item[1].size == i %}
        <li>
          <a href="#{{ item[0] | slugify }}">
            <strong>{{ item[0] }}</strong> <span class="taxonomy__count">{{ i }}</span>
          </a>
        </li>
      {% endif %}
    {% endfor %}
  {% endfor %}
</ul>

{% assign entries_layout = page.entries_layout | default: 'list' %}
{% for i in (1..items_max) reversed %}
  {% for taxonomy in include.taxonomies %}
    {% if taxonomy[1].size == i %}
      <section id="{{ taxonomy[0] | slugify }}" class="taxonomy__section">
        <h2 class="archive__subtitle">{{ taxonomy[0] }}</h2>
        <div class="entries-{{ entries_layout }}">
          {% for post in taxonomy.last %}
            {% include archive-single.html type=entries_layout %}
          {% endfor %}
        </div>
        <a href="#page-title" class="back-to-top">{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} &uarr;</a>
      </section>
    {% endif %}
  {% endfor %}
{% endfor %}
